/*
 * @lc app=leetcode.cn id=709 lang=swift
 *
 * [709] 转换成小写字母
 */

// @lc code=start
// class Solution {
//     func toLowerCase(_ s: String) -> String {
//         return s.lowercased
//     }
// }

class Solution {
    func toLowerCase(_ s: String) -> String {
        var result: String = ""
        let distance = Character("a").asciiValue! - Character("A").asciiValue!
        for c in s {
            if c >= "A" && c <= "Z" {
                result.append(Character(Unicode.Scalar(c.asciiValue! + distance)))
            }else{
                result.append(c)
            }
            
        }
        return result
    }
}
// @lc code=end

